package rudy.elevator.thread;

import rudy.elevator.bean.LiftBean;
import rudy.elevator.ui.MainPanel;

public class CloseThread extends Thread {
    LiftBean lift;
    MainPanel panel;
    public  CloseThread(LiftBean lift, MainPanel panel) {
        this.lift = lift;
        this.panel = panel;
    }

    public void run() {
        for (int i = 0; i < lift.getDx() / 2; i++) {
            lift.setXx(lift.getDx() / 2 - i - 1);
            try {
                Thread.sleep(5);
            } catch (InterruptedException ex) {
            }
            panel.repaint();
        }

    }
}
